<?php
require_once 'Junction/Builder/Definition.php';
require_once 'Junction/Builder/DirectReference.php';
require_once 'Junction/Utils/Xml/Exception.php';
require_once 'Junction/Utils/Xml/Handler.php';
require_once 'Junction/Utils/Xml/Parser.php';

class Junction_Builder_Handlers_DirectReference implements Junction_Utils_Xml_Handler {
	
	/**
	 * 
	 * @throws Junction_Utils_Xml_Exception
	 * 
	 * @return Junction_Builder_Collection
	 */
	public function handle(SimpleXMLElement $root) {
	    $attrs = Junction_Utils_Xml_Parser::collectAttributes($root);
		return new Junction_Builder_DirectReference($attrs[Junction_Builder_Definition::nameAttribute], 
		                $attrs[Junction_Builder_Definition::classAttribute]);
	}
}
?>